<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
	<title>登陆</title>
	<style>
	*{
		margin: 0;
		padding: 0;
	}
		body{
         width: 100%;
         height: 100%;
         background: url('/resources/images/login.png');
         background-size: 100%;
         background-repeat: no-repeat;
		}
		.login_box{
			width: 80%;
			height: 300px;
			margin: 0 auto;
			margin-top: 200px;
		}
		.login_dis{
			width: 100%;
			height: 40px;
			border: 1px solid #fff;
			border-radius: 5px;
			display: flex;
			margin-bottom: 30px;
		}
		.login_dis_img{
			width: 20%;
			height: 40px;
			text-align: center;
		}
		.login_dis_img img{
			width: 20px;
			height: 20px;
			margin-top: 10px;
		}
		.login_dis_input{
			width: 90%;
			height: 40px;
		}
		.login_dis_input input{
			width: 100%;
			height: 40px;
			border: none;
			outline: none;
			background: none;
			color: #fff;
		}
		.login_dis_input input::-webkit-input-placeholder{
			color: #fff;
		}
		.login_btn{
			width: 70%;
			height: 40px;
			text-align: center;
			line-height: 40px;
			background-color: #3284a9;
			color: #fff;
			border-radius: 5px;
			margin: 0 auto;
			margin-top: 20px;
		}
		.login_text{
			font-size: 14px;
			margin-left: 20px;
		}
		.login_forget{
			font-size: 14px;
			margin-right: 20px;
		}
	</style>
	[#include "/includes/scripts.html" /]
</head>
<body>

	<div class="login_box">
		<div class="login_dis">
			<div class="login_dis_img"><img src="/resources/images/shouji.png" alt=""></div>
			<div class="login_dis_input"><input type="text" id="phone" name="phone" placeholder="请输入手机号"></div>
		</div>
		<div class="login_dis">
			<div class="login_dis_img"><img src="/resources/images/mima.png" alt=""></div>
			<div class="login_dis_input"><input type="text" id="password" name="password" placeholder="请输入密码"></div>
		</div>
		<div style="line-height: 40px;display: flex;justify-content: space-between;">
			<div class="login_text"><a href="${webctx}/register" style="color:#fff;text-decoration: none;">注册</a></div>
			<div class="login_forget"><a href="${webctx}/forget" style="color:#fff;text-decoration: none;">忘记密码？</a></div>
		</div>
		<div class="login_btn" id="login_btn" onclick="login()">登录</div>
	</div>
<script type="text/javascript">
	function login() {
	    var btn = $("#login_btn");
        btn.addClass("disabled");
        var phone = $("#phone").val();
        var password = $("#password").val();

        if(phone == "" || password == ""){
            //BootstrapDialog.alert({title:'提示', message:'请填写账号密码！'});
			alert("请填写账号密码！");
            btn.removeClass("disabled");
            return;
        }

        $.ajax({
            type : "POST",
            url : "/doLogin",
            contentType : "application/x-www-form-urlencoded; charset=utf-8",
            dataType : "json",
            data : {
                phone : phone,
                password : password
            },
            success : function(ret) {
                if (ret.isOk) {
                    location.href = "${webctx}/index";
                }if (ret.isFail) {
                    alert(ret.msg);
                    btn.removeClass("disabled");
                    return;
                }
            }
        })

//        var imei;
//        if (window.SquareObj) {
//            imei = window.SquareObj.getIMEI();
//            doLogin(imei);
//        } else {
//            setupWebViewJavascriptBridge(function (bridge) {
//                bridge.callHandler('getIMEI','',function(imei){
//                    doLogin(imei);
//                });
//            });
//        }
    }

//    function setupWebViewJavascriptBridge(callback) {
//        if (window.WebViewJavascriptBridge) { return callback(WebViewJavascriptBridge); }
//        if (window.WVJBCallbacks) { return window.WVJBCallbacks.push(callback); }
//        window.WVJBCallbacks = [callback];
//        var WVJBIframe = document.createElement('iframe');
//        WVJBIframe.style.display = 'none';
//        WVJBIframe.src = 'https://__bridge_loaded__';
//        document.documentElement.appendChild(WVJBIframe);
//        setTimeout(function() { document.documentElement.removeChild(WVJBIframe) }, 0)
//    }
</script>
	
</body>
</html>